Yaroslav PetrichkaSolo Founder

Automating publishing Unity packages to npm registry

1 min read

🎯 Why npmjs registry?

  • Ready up to open source projects
  • In-box GitHub Actions solution
  • CLI support
  1. Generate Access Token in npmjs registry

  2. Select Access Token type

  3. Add npm Access Token to GitHub repository secrets

  4. Config GitHub workflow using a yml template as follows

name: npm

on:
  release:
    types: [published]

jobs:
  publish-npm:
    runs-on: ubuntu-latest
    permissions:
      contents: read
      packages: write
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-node@v3
        with:
          node-version: '20.x'
          registry-url: https://registry.npmjs.org
      - run: npm install --package-lock-only
      - run: npm ci
      - run: npm publish
        env:
          NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
          GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}

🎉 Now GitHub Actions will automatically upload package to npmjs registry

🎁 Sample project

Unity AutoKeystore

All Posts
Yaroslav Petrichka Avatar

Yaroslav Petrichka

Solo Founder

Building digital products independently. Sharing insights on the journey of solo software development.

© 2025 Yaroslav Petrichka. All rights reserved.
Built withusingNext.js